package com.michael;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/3/12 0012.
 */
public class DeepCloneTest {

    public static void main(String[] args) {
        ShallowClone clone = new ShallowClone();
        clone.setName("Michael");
        clone.setAge(20);
        List<Course> courses = new ArrayList<>(2);
        Course course1 = new Course();
        course1.setCname("Java");
        course1.setCore(98);
        Course course2 = new Course();
        course2.setCname("Golang");
        course2.setCore(95);
        courses.add(course1);
        courses.add(course2);

        clone.setCourses(courses);
        ShallowClone clone1 = clone.deepClone();

        System.out.println(clone.getCourses());
        System.out.println(clone1.getCourses());
        System.out.println(clone.getCourses() == clone1.getCourses());
    }
}
